package com.example.walkera.serialndkdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;


public class MainActivity extends AppCompatActivity {

    private static String TAG="MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /*使用serial进行数据发送*/
        /*启动一个发送0x55的activity*/
        final Button button01010101 = (Button)findViewById(R.id.Button_Send01010101);
        button01010101.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Log.d(TAG, "onClick: startActivity Sending01010101Activity");
                startActivity(new Intent(MainActivity.this, Sending01010101Activity.class));
            }
        });
        final Button buttonloopback =(Button)findViewById(R.id.Buttion_Loopback);
        buttonloopback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d(TAG, "onClick: StartActi vity");
                startActivity(new Intent(MainActivity.this,LoopbackActivity.class));
            }
        });

        /*设置退出buttion监听器*/
        final Button buttonquit = (Button)findViewById(R.id.Button_Quit);
        buttonquit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.this.finish();
            }
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
